Separation Subroutine

private subroutine Separation(prediction, observations, estdist)

Subroutine to find the distances between prediction point and observations. Also returns angles if anisotropy present

Arguments

Type IntentOptional Attributes Name
type(site), intent(in) :: prediction
type(ObservationalNetwork), intent(in) :: observations
type(site), intent(out), DIMENSION(:) :: estdist

Variables

Type Visibility Attributes Name Initial
integer(kind=short), public :: i

Source Code

SUBROUTINE Separation &
!!
(prediction, observations, estdist)

IMPLICIT NONE

!Arguments with intent(in):
TYPE (site), INTENT(IN) :: prediction
TYPE (ObservationalNetwork), INTENT(IN) :: observations

!Arguments with intent(out):
TYPE( site), DIMENSION(:), INTENT(out) :: estdist

!local declarations:
INTEGER (KIND = short) :: i

!----------------------------------------end of declarations-------------------

DO i = 1, observations % countObs
  estdist (i) % h = Distance (prediction % xyz, observations % obs (i) % xyz)
  estdist (i) % oid = i
  estdist (i) % value = observations % obs (i) % value
  estdist (i) % xyz % easting = observations % obs (i) % xyz % easting
  estdist (i) % xyz % northing = observations % obs (i) % xyz % northing
  !Return the angle between points if anisotropy is present 
  IF ( anisotropyAngle > 0.) THEN
     estdist (i) % theta = pi / 2. - DirectionAngle (prediction % xyz, observations % obs (i) % xyz)
     !estdist (i) % theta = ATAN ( (observations % obs (i) % xyz % northing - prediction % xyz % northing) /  &
     ! (observations % obs (i) % xyz % easting - prediction % xyz % easting)  )  
  ELSE
     estdist (i) % theta = 0.
  END IF
  
END DO

RETURN
END SUBROUTINE Separation